
///错误编码
class Code {
  ///网络错误
  static const networkError = -1;

  ///网络超时
  static const networkTimeout = -2;

  ///网络返回数据格式化一次
  static const networkJsonException = -3;

  ///Github APi Connection refused
  static const githubApiRefused = -4;

  /// 请求错误,未授权
  static const failure = -5;

  /// 请求错误，服务器内部错误
  static const serverError = -6;

  static const success = 200;

  static errorHandleFunction(code, message, noTip) {
    if (noTip) {
      return message;
    }
    if(message != null && message is String && (message.contains("Connection refused") || message.contains("Connection reset"))) {
      code = githubApiRefused;
    }
    // eventBus.fire(new HttpErrorEvent(code, message));
    return message;
  }
}
